<template>
    <van-nav-bar title="隐私政策" left-arrow @click-left="handleLeft">
    </van-nav-bar>
    <div class="policy-index">
        <div class="policy-index-content ql-editor" v-if="privacyPolicy">
            <p v-html="privacyPolicy"></p>
        </div>
    </div>
</template>
<script setup lang="ts">
import "@/styles/quill.css";
import { listNotice } from '@/api/loginApi'
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();
// 隐私协议是否勾选
const checked = computed(() => {
    return route.query.checked;
});
const privacyPolicy = ref('')
/** 获取隐私协议 */
const getNotice = async () => {
    const res = await listNotice({ NoticeQuery: '隐私协议' })
    const privacyNotice = res.rows.find(item => item.noticeTitle === '隐私协议');
    if (privacyNotice) {
        privacyPolicy.value = privacyNotice.noticeContent;
    }
}
getNotice()
/** 返回 */
const handleLeft = () => {
    if (checked.value) {
        router.push({
            path: '/login',
            query: {
                checked: checked.value
            }
        })
    } else {
        router.go(-1)
    }
}
</script>
<style lang="less" scoped>
.policy-index {
    .policy-index-content {
        padding: 10px;
        height: calc(100vh - 90px);
        width: 100%;
        overflow-y: auto;
    }
}

.ql-align-center {
    text-align: center;
}

:deep(.van-nav-bar__left .van-icon) {
    color: #1a1b1c !important;
}
</style>